Assign bikes as F mode#584
Conversation
… the model run and mostly invisible to the end user. The reason for the solution is backwards compatibility.
There was a problem hiding this comment.
To my understanding, you would achieve the same result simply by
- allowing
hon all links (and never disallowing it) - changing mode in bike assignment to
f
Please explain if I have overlooked some problem with this simpler approach.
By the way, do you know if having h allowed on all links in car assignment affects performance?
| #Add h mode everywhere just to be sure | ||
| network = self.emme_scenario.get_network() | ||
| main_mode = network.mode(param.main_mode) | ||
| for link in network.links(): | ||
| link.modes |= {main_mode} | ||
| self.emme_scenario.publish_network(network) | ||
|
|
There was a problem hiding this comment.
Why do you do this here, when it has nothing to do with pedestrian assignment?
There was a problem hiding this comment.
This is more like a fix for the older networks to bring them to newer standard.
There was a problem hiding this comment.
Yes, so maybe you could move this fix to some more natural place, like prepare()?
There was a problem hiding this comment.
Good idea, I moved them to prepare. Prepare does not seem to be used for mock assignment, but that does not seem to be a big issue as of now.
| if car_mode in link.modes: | ||
| link.modes |= {main_mode} |
There was a problem hiding this comment.
You have already allowed main_mode on all links, so this is unnecessary now, is it not?
There was a problem hiding this comment.
This can indeed be dropped.
| self.event_handler.on_assignment_started(self, iteration, matrices) | ||
| self._set_emmebank_matrices(matrices, iteration=="last") | ||
| if iteration=="init": | ||
| self._create_bike_auto_mode() |
There was a problem hiding this comment.
What do you need this new mode for? Can you not simply use f?
There was a problem hiding this comment.
f mode is aux_transit, not aux_auto. I think aux_transit is not accepted in car assignment. Or would it be a good idea to change it during the model run?
There was a problem hiding this comment.
Ah, you are right! So why not just change f into aux_auto? I see no reason to have it as aux_transit anymore.
Originally, bike LOS was taken from pedestrian assignment (which is technically transit assignment), but when we started developing the bike assignment, we realized that car assignment would work better. I did not change f into aux_auto of pure laziness.
There was a problem hiding this comment.
Yes, after discussing this issue with the development team we decided to change the "f" mode to AUX_AUTO and adjust the scenarios accordingly. "F" mode will not be used. This will be backwards incompatible, but the change is easy to do if there is need to run older scenarios.
Simpler approach with h mode everywhere would not eliminate bikes where they do not belong. About performance, I have not tested it, but since we are mostly using subnetworks in the car assignment I don't see how it would affect performance except for the first step - creating the subnet (which is done only once). |
Are you sure gradient search is not performed for all links where the main mode is allowed? My guess would be that it is. |
…tion to existing one) to f mode (existing bike mode that would be AUX_AUTO from now on).
I am not sure where to look for evidence on this. However the "big model" tests did not show any noticeable extra delay, if there is, it is probably in seconds. |
As of now, bike assignment is done as "h" mode. This creates issues with turning restrictions, because the information about turning restrictions is kept in the "h" mode. However, on links like "hcvky", "h" mode is removed for bike assignment and at the same time any possible turning restrictions for cars are removed as well. Once we proceed into car assignment, "cvky" turns back into "hcvky", but the turning restriction is missing - it disappears.
As a remedy, I propose to do the bike assignment properly, as a "F" mode subnetwork of the "h" mode main network. Due to backwards compatilbility, "F" mode is only used as virtual "AUX_AUTO" mode. "f" mode on the other hand is "AUX_TRANSIT". There probably used to be some idea in the past to use transit assignment for bikes, but it remained unimplemented.
When I implemented the change, some things did not work out of the box, there needs to be valid vdf, valid number of lanes and valid time_auto travel time. They are not used in the assignments to my understanding, but they are required for the initial checks. All these adjustments are part of this PR.
This PR should close this issue:
#583
Note: I am only pushing this into Helmet 5 as olusanya had this behavior since the beginning.